﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef double Real;

typedef struct TContext_s
{
	int n;
	Real* v;
}TContext;

TContext context;

void read_data(TContext* ctx)
{
	scanf("%d", &ctx->n);
	ctx->v = (Real*)malloc(ctx->n * sizeof(Real));
	for (int i = 0; i < ctx->n; ++i)
	{
		scanf("%lf", &ctx->v[i]);
	}
}

Real average(TContext* ctx)
{
	Real s = 0;
	for (int i = 0; i < ctx->n; ++i)
		s += ctx->v[i];
	return s / ctx->n;
}

void do_task(TContext* ctx)
{
	Real a = average(ctx);
	Real min = ctx->v[0];
	Real max = min;
	for (int i = 1; i < ctx->n; ++i)
		if (min > ctx->v[i])
			min = ctx->v[i];
		else if (max < ctx->v[i])
			max = ctx->v[i];
	printf("average = %.2f\n", a);
	printf("max = %.2f\n", max);
	printf("min = %.2f\n", min);
}

void solve(TContext* ctx)
{
	read_data(ctx);
	do_task(ctx);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-111.txt", "r", stdin);
	solve(&context);
	return 0;
}
